<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/view/include/inc.jsp"%>
<!DOCTYPE html>
<html lang="en">
<head>
<%@ include file="/WEB-INF/view/jQgrid.jsp"%>
<script src="<%=contextPath%>/js/zDialog.js"></script>
<script src="<%=contextPath%>/js/zDrag.js"></script>
<title>${company.name}_公司详情</title>
</head>
<body>
	<div class="container-fluid" id="main-container">
	    <input type="hidden" id="id" value="${company.id}">
	    <input type="hidden" id="name" value="${company.name}">
		<div id="page-content" class="clearfix">
			<div class="row-fluid">
				<div class="col-sm-12" style="margin-top: 20px;">
					<div class="col-sm-6" style="padding-left: 50px;line-height:30px;">
						<h3 ><i class="icon-user"></i> 企业基本信息</h3>
					</div>
					<div class="col-sm-6" style="padding-right: 50px;float: right;text-align: right;">
						<div class="form-group">
						    <a id="addcontact" class="btn btn-primary" onclick="addcontact();">添加企业联系人</a>
						    <a class="btn btn-info" onclick="showcontact();">企业联系人列表</a>
						    <a class="btn btn-warning" onclick="showorg();">组织架构</a>
							<%-- <a href="<%=contextPath%>/company/list" class="btn btn-info">返回列表</a> --%>
						</div>
					</div>
				</div>
				<div class="col-sm-12">
					<table border="1" class="table table-bordered">
						<tbody>
							<tr>
								<td width="15%">
									<p align="right">公司名称:</p>
								</td>
								<td width="15%">
									<p>${company.name }</p>
								</td>
								<td width="15%">
									<p align="right">公司简称:</p>
								</td>
								<td width="15%">
									<p>${company.shortName }</p>
								</td>
								<td width="15%">
									<p align="right">公司性质:</p>
								</td >
								<td width="15%">
									<p>${fns:getDictLabel(company.nature,'company_nature','')}</p>
								</td>
							</tr>
							<tr>
								<td>
									<p align="right">法定代表人:</p>
								</td>
								<td>
									<p>${company.legalPerson }</p>
								</td>
								<td>
									<p align="right">注册资本:</p>
								</td>
								<td>
									<p>${company.capital }</p>
								</td>
								<td>
									<p align="right">公司行业:</p>
								</td>
								<td>
									<p>${company.industryNames }</p>
								</td>
							</tr>
							<tr>
								<td>
									<p align="right">公司规模:</p>
								</td>
								<td>
									<p>${fns:getDictLabel(company.scale,'company_scale','')}</p>
								</td>
								<td>
									<p align="right">公司投资人或者股东:</p>
								</td>
								<td>
									<p>${company.investor }</p>
								</td>
								<td>
									<p align="right">社会统一信用代码:</p>
								</td>
								<td>
									<p>${company.invoice }</p>
								</td>
							</tr>
							<tr>
								<td>
									<p align="right">公司网址:</p>
								</td>
								<td>
									<p><a href="${company.website }" target="_blank" title="点击打开">${company.website }</a></p>
								</td>
								<td>
									<p align="right">公司简介:</p>
								</td>
								<td>
									<p title="${company.profile }">${fn:substring(company.profile,0,100)}...</p>
								</td>
								<td>
									<p align="right">核心竞争优势:</p>
								</td>
								<td>
									<p>${company.advantage }</p>
								</td>
							</tr>
							<tr>
								<td>
									<p align="right">总部所在地:</p>
								</td>
								<td>
									<p>${company.headquarter }</p>
								</td>
								<td>
									<p align="right">所在区域:</p>
								</td>
								<td>
									<p>${company.area.treeNames }</p>
								</td>
								<td>
									<p align="right">客户状态:</p>
								</td>
								<td>
									<p>${fns:getDictLabel(company.isStatus,'company_status','')}</p>
								</td>
							</tr>
						</tbody>
					</table>

				</div>
			</div>
			<div class="row-fluid">
				<div class="col-sm-12">
					<div class="col-sm-6" style="padding-left: 50px;line-height:30px;">
						<h3 ><i class="icon-external-link"></i> 招聘信息(<font color="red">${demands_count}</font>)</h3>
					</div>
					<div class="col-sm-6" style="padding-right: 50px;float: right;text-align: right;">
						<div class="form-group">
							<button type="button" class="btn-sm btn-info" onclick="adddemand();">添加</button>
						</div>
					</div>
				</div>
				<div class="col-sm-12">
					<table class="table table-bordered">
						<thead>
							<tr>
								<th>岗位名称</th>
								<th>需求人数</th>
								<th>对接人姓名</th>
								<th>工作区域</th>
								<th>创建时间</th>
								<th>修改时间</th>
								<th>编辑人</th>
								<th>操作</th>
							</tr>
						</thead>
						<tbody>
						<c:forEach items="${demands }" var="demand">
						   <tr>
								<td><a onclick="showdemand(&quot;${demand.id}&quot;);">${demand.positionName }</a></td>
								<td>${demand.demandNum}</td>
								<td>${demand.contacts.resume.trueName}</td>
								<td>${demand.workAreaNames}</td>
								<td>${demand.createDate}</td>
								<td>${demand.updateDate}</td>
								<td>${demand.updateUser.truename}</td>
								<td>
									<a class="btn-sm btn-info" onclick="showdemand(&quot;${demand.id}&quot;);">查看</a>&nbsp;&nbsp;
									<a class="btn-sm btn-warning" onclick="adddemand();">继续添加</a>&nbsp;&nbsp;
									<a class="btn-sm btn-danger" onclick="editdemand(&quot;${demand.id}&quot;);">修改</a>&nbsp;&nbsp;
									<a class="btn-sm btn-primary" onclick="addrecommend(&quot;${demand.id}&quot;,&quot;${demand.positionName}&quot;);">推荐</a>
								</td>
							</tr>
						</c:forEach>
						</tbody>
					</table>
				</div>
			</div>
			<div class="row-fluid">
				<div class="col-sm-12">
					<div class="col-sm-6" style="padding-left: 50px;line-height:30px;">
						<h3 ><i class="icon-external-link"></i> 推荐记录(<font color="red">${recommends_count}</font>)</h3>
					</div>
					<div class="col-sm-6" style="padding-right: 50px;float: right;text-align: right;">
						<div class="form-group">
							<button type="button" class="btn-sm btn-info" onclick="newrecommend();">添加</button>
						</div>
					</div>
				</div>
				<div class="col-sm-12">
					<table class="table table-bordered">
						<thead>
							<tr>
								<th>岗位名称</th>
								<th>候选人姓名</th>
								<th>推荐意见</th>
								<th>推荐结果</th>
								<th>推荐时间</th>
								<th>推荐人</th>
								<th>操作</th>
							</tr>
						</thead>
						<tbody>
						<c:forEach items="${recommends }" var="recommend">
						   <tr>
								<td><a onclick="showdemand(&quot;${recommend.demandId}&quot;)" title="岗位详情">${recommend.dEnterprise.positionName }</a></td>
								<td><a class="J_menuItem" href="<%=contextPath%>/resume/detailView?id=${recommend.talentsId}" title="人才详情" target="_blank">${recommend.resume.trueName}</a></td>
								<td>${recommend.reason}</td>
								<td><a onclick="openresult(&quot;${recommend.id}&quot;);" class="btm-sm btn-link">查看详请</a></td>
								<td>${recommend.createDate}</td>
								<td>${recommend.createUser.truename}</td>
								<td>
									<a class="btn-sm btn-warning" onclick="newrecommend();">继续推荐</a>&nbsp;&nbsp;
									<a class="btn-sm btn-info" onclick="downreport(&quot;${recommend.reportFile }&quot;);">下载</a>&nbsp;&nbsp;
									<%-- <a class="btn-sm btn-danger" onclick="editrecommend(&quot;${recommend.id}&quot;);">修改</a>&nbsp;&nbsp; --%>
									<a class="btn-sm btn-warning" onclick="addcommunicate(&quot;${recommend.talentsId}&quot;);" title="对候选人沟通">沟通</a>&nbsp;&nbsp;
									<a class="btn-sm btn-primary" onclick="addfeedback(&quot;${recommend.id}&quot;);">反馈结果</a>
								</td>
							</tr>
						</c:forEach>
						</tbody>
					</table>
				</div>
			</div>
			<div class="row-fluid">
				<div class="col-sm-12">
					<div class="col-sm-6" style="padding-left: 50px;line-height:30px;">
						<h3 ><i class="icon-comments"></i> 沟通记录(<font color="red">${communicates_count}</font>)</h3>
					</div>
					<div class="col-sm-6" style="padding-right: 50px;float: right;text-align: right;">
						<!-- <div class="form-group">
							<button type="button" class="btn-sm btn-info" onclick="addcommunicate();">添加</button>
						</div> -->
					</div>
				</div>
				<div class="col-sm-12">
					<table class="table table-bordered">
						<thead>
							<tr>
								<th>联系人</th>
								<th>联系电话</th>
								<th>沟通方式</th>
								<th>沟通目的</th>
								<th>沟通内容</th>
								<th>沟通时间</th>
								<th>沟通人</th>
								<th>操作</th>
							</tr>
						</thead>
						<tbody>
						<c:forEach items="${communicates }" var="communicate">
							<tr>
								<td>${communicate.resume.trueName }</td>
								<td>${communicate.resume.cellphone }</td>
								<td>${communicate.methods }</td>
								<td>${communicate.intentionality }</td>
								<td>${communicate.details }</td>
								<td>${communicate.communicationTime }</td>
								<td>${communicate.user.truename }</td>
								<td>
								   <a class="btn-sm btn-warning" onclick="addcommunicate(&quot;${communicate.telentsId}&quot;);">继续沟通</a>&nbsp;&nbsp;
								   <a class="btn-sm btn-danger" onclick="feedback(&quot;${communicate.telentsId}&quot;);">结果反馈</a>
								</td>
							</tr>
						</c:forEach>
						</tbody>
					</table>
				</div>
			</div>
			<div class="row-fluid">
				<div class="col-sm-12">
					<div class="col-sm-6" style="padding-left: 50px;line-height:30px;">
						<h3 ><i class="icon-comments"></i> 合同管理(<font color="red">${contracts_count}</font>)</h3>
					</div>
					<div class="col-sm-6" style="padding-right: 50px;float: right;text-align: right;">
						<div class="form-group">
							<button type="button" class="btn-sm btn-info" onclick="addcontract();">添加</button>
						</div>
					</div>
				</div>
				<div class="col-sm-12">
					<table class="table table-bordered">
						<thead>
							<tr>
								<th>合同编号</th>
								<th>签约方</th>
								<th>合同开始日期</th>
								<th>合同结束日期</th>
								<th>服务费计算基数</th>
								<th>费率</th>
								<th>保障期</th>
								<th>操作</th>
							</tr>
						</thead>
						<tbody>
						<c:forEach items="${contracts }" var="contract">
							<tr>
								<td>${contract.contractNo }</td>
								<td>${contract.signing }</td>
								<td>${contract.startDate }</td>
								<td>${contract.endDate }</td>
								<td>${contract.cardinal }</td>
								<td>${contract.rate }</td>
								<td>${contract.assure }</td>
								<td><a class="btn-sm btn-warning" onclick="addcontract();">继续签约</a>&nbsp;&nbsp;<a class="btn-sm btn-danger" onclick="editcontract(&quot;${contract.id}&quot;);">修改</a></td>
							</tr>
						</c:forEach>
						</tbody>
					</table>
				</div>
			</div>
				</div>
				<!-- PAGE CONTENT ENDS HERE -->

			</div>
			<!--/row-->
		</div>
		<!--/#page-content-->
	</div>
	<!--/.fluid-container#main-container-->
	<script type="text/javascript">
	var companyId = $("#id").val();
	var companyName = $("#name").val();
	$(function () {
		$("#addcontact").click(function () {
			openwindow("添加企业联系人", "<%=contextPath%>/company/addContactView?companyId=" + companyId, 600, 750);
		})
	})
	function adddemand() {
		openwindow("添加招聘需求", "<%=contextPath%>/demandEnterprise/addView?companyId=" + companyId +"&tops=1", 900, 750);
	}
	function editdemand(id) {
		openwindow("修改招聘需求", "<%=contextPath%>/demandEnterprise/editView?id=" + id, 900, 750);
	}
	function addrecommend(id,postion) {
		openwindow("新增人才推荐", "<%=contextPath%>/talentsRecommend/addView?demandId=" + id +"&companyId=" + companyId +"&postion="+postion, 600, 750);
	}
	function newrecommend() {
		openwindow("新增人才推荐", "<%=contextPath%>/talentsRecommend/addView?companyId=" + companyId, 600, 750);
	}
	function addcontract() {
		openwindow("新增合同", "<%=contextPath%>/contract/addView?companyId=" + companyId,  850, 550);
	}
	function editcontract(id) {
		openwindow("修改合同", "<%=contextPath%>/contract/editView?id=" + id, 600, 750);
	}
	function addcommunicate(id) {
		openwindow("添加沟通", "<%=contextPath%>/demandCommunicate/addView?talentsId="+id+"&companyId=" + companyId, 600, 750);
	}
	function editrecommend(id) {
		openwindow("修改人才推荐", "<%=contextPath%>/talentsRecommend/editView?id=" + id , 600, 750);
	}
	function showdemand(id) {
		window.open("<%=contextPath%>/demandEnterprise/detailView?id=" + id);
	}
	function addfeedback(recommandId) {
		openwindow("反馈推荐结果", "<%=contextPath%>/recommendResult/addView?recommandId=" + recommandId +"&companyId=" + companyId, 500, 400);
	}
	function openresult(recommandId) {
		openwindow("查看推荐结果", "<%=contextPath%>/recommendResult/resultView?recommandId=" + recommandId +"&companyId=" + companyId, 800, 600);
	}
	//查看需求详情
	function showtalents(id) {
		window.location.href="<%=contextPath%>/resume/detailView?id=" + id;
	}
	function downreport(file){
		var doc = '<%=contextPath%>'+file; 
		var triggerDownload = $("<a>").attr("href", doc).attr("download", doc).appendTo("body"); 
   	    triggerDownload[0].click(); 
        triggerDownload.remove();
	}
	function showcontact() {
		openwindow("查看企业联系人", "<%=contextPath%>/company/contactList?companyId=" + companyId, 1080, 750);
	}
	function showorg(){
		openwindow("查看组织架构", "<%=contextPath%>/organize/orgView?companyId=" + companyId, 500, 550);
	}
	function openwindow(title,url,width,height){
	 var diag = new Dialog();
	 diag.Drag=true;
	 diag.Title =title;
	 diag.URL = url;
	 diag.Width = width;
	 diag.Height = height;
	 diag.CancelEvent = function(){ //关闭事件
		document.location.reload();
		diag.close();
	 };
	 diag.show();
}//是通过这个方法打开的子窗体
	</script>
</body>
</html>

